#include <QCoreApplication>
#include <exception>
#include <iostream>


class NewException : public std::exception
{
private:
    std::string mssg;
public:
    ~NewException() {}
    NewException(std::string mssg)
    {
        this->mssg = mssg;
    }
    virtual const char* what() const throw()
    {
        return this->mssg.c_str();
    }
};

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    try
    {
        throw NewException("new_exception");
    }
    catch (std::exception& e)
    {
        std::cout << e.what() << std::endl;
    }

    return a.exec();
}
